package cn.iocoder.yudao.module.trade.dal.mysql.orderpostback;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.trade.dal.dataobject.orderpostback.OrderPostBackDO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.trade.controller.admin.orderpostback.vo.*;
import org.apache.ibatis.annotations.Param;

/**
 * 订单回传 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface OrderPostBackMapper extends BaseMapperX<OrderPostBackDO> {

    default PageResult<OrderPostBackDO> selectPage(OrderPostBackPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<OrderPostBackDO>()
                .eqIfPresent(OrderPostBackDO::getOrderId, reqVO.getOrderId())
                .eqIfPresent(OrderPostBackDO::getOrderType, reqVO.getOrderType())
                .eqIfPresent(OrderPostBackDO::getThirdId, reqVO.getThirdId())
                .eqIfPresent(OrderPostBackDO::getThirdType, reqVO.getThirdType())
                .eqIfPresent(OrderPostBackDO::getPayPrice, reqVO.getPayPrice())
                .eqIfPresent(OrderPostBackDO::getPostPrice, reqVO.getPostPrice())
                .eqIfPresent(OrderPostBackDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(OrderPostBackDO::getPostTime, reqVO.getPostTime())
                .betweenIfPresent(OrderPostBackDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(OrderPostBackDO::getId));
    }

    IPage<DrainagePostBackRespVO> selectOrderPostBackPageByDrainageId(Page<?> page, @Param("query") DrainagePostBackPageReqVO reqVO);

}